#include <stdio.h> 

int main()
{
	int n = 0;
	int max = 0;
	int min = 0;
	int data = 0;
	
	scanf("%d", &n);
	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &data);
		if ( i == 0 ) {
			max = data;
			min = data;
		}
		
		if ( max < data ) {
			max = data;
		}
		if ( min > data ) {
			min = data;
		}
	}
	printf("%d", max - min);
	return 0;
}
